package com.zktr.dao;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.List;

import com.zktr.pojo.CollectGoods;
import com.zktr.utils.CRUDDAO;

public class CollectGoodsDao {
	CRUDDAO<CollectGoods> crud = new CRUDDAO<>(CollectGoods.class);   
	public static void main(String[] args) {
		CollectGoodsDao gDao = new CollectGoodsDao();
		List<CollectGoods> qAGoods = gDao.queryAllCollectGoods();
		//System.out.println(qAGoods);
		for (CollectGoods collectGoods : qAGoods) {
			Calendar cal=Calendar.getInstance();
			long millions=new Long(collectGoods.getAddtime()).longValue()*1000;
			cal.setTimeInMillis(millions);
			SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd   HH-mm-ss");
			System.out.println(df.format(cal.getTime())); 
		}
		
	}
	/**
	 * 查询所有数据
	 * @return
	 */
	public List<CollectGoods> queryAllCollectGoods(){
    	   String sql="select * from collect_goods";
    	   LinkedHashMap<String, Object[]> map = new LinkedHashMap<String,Object[]>();
    	   map.put(sql, null);
    	   return crud.selectAll(map).get(0);
    	   
       }
}
